# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Dave Reisner <dreisner@archlinux.org>
# Contributor: Matthias Blaicher <matthias@blaicher.com>
# Contributor: Severen Redwood <severen@shrike.me>

pkgname=capnproto
pkgver=0.10.4
pkgrel=1
pkgdesc="Cap'n Proto serialization/RPC system"
arch=(loong64 x86_64)
url="https://capnproto.org/"
license=(MIT)
depends=(
  gcc-libs
  glibc
  openssl
  zlib
)
makedepends=(cmake)
provides=(
  libcapnp.so
  libcapnp-json.so
  libcapnp-rpc.so
  libcapnpc.so
  libkj-async.so
  libkj-gzip.so
  libkj-http.so
  libkj-test.so
  libkj-tls.so
  libkj.so
)
source=($pkgname-$pkgver.tar.gz::https://github.com/$pkgname/$pkgname/archive/v$pkgver.tar.gz)
sha512sums=('6179a202399f4391014827799c954e0b3ad811ab82ebd0addc01d8c7695b9c1a9c0a0c26b018cd392e3731e12b30cca58545459d1b3a140e86e34b75d7eacbc7')
b2sums=('3a893b766302a96df71763613fa1624f6b7229b8926099d1d9c217f4a1817db16aa24d3bec7950e480da6b027bd9b6b0b5a4083e982e7bda8fc6594794fd379a')

build() {
  local cmake_options=(
      -B build
      -D BUILD_SHARED_LIBS=ON
      -D CMAKE_BUILD_TYPE=None
      -D CMAKE_INSTALL_PREFIX=/usr
      -S $pkgname-$pkgver
      -W no-dev
  )

  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  install -vDm 644 $pkgname-$pkgver/LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -vDm 644 $pkgname-$pkgver/{CONTRIBUTORS,README.md} -t "$pkgdir/usr/share/doc/$pkgname/"
}
# vim:set ts=2 sw=2 et:
